<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<script>
			var arr = [2,3,1,4,2,4,4,2,5,6,8,44,22,52,8,1];
			var arr = arr.sort(function(a,b){
				return a-b;
			});//排序
			
			var newArr = [];
			newArr.push(arr[0])
			for(i=1;i<arr.length;i++){
				if(newArr[newArr.length-1]!=arr[i]){
					newArr.push(arr[i])
				}
			}//去重
			console.log(newArr);
			//console.log(newArr.join(',').split(','));//["1", "2", "5", "6", "8", "22", "44", "52"]
			//console.log(newArr.join('').split(','));//["12568224452"]
			//console.log(newArr.join(',').split(''));//["1", ",", "2", ",", "5", ",", "6", ",", "8", ",", "2", "2", ",", "4", "4", ",", "5", "2"]
		</script>
	</body>
</html>
